// AudioDX.h: interface for the CAudioDX class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AUDIODX_H__75427EBD_9F1A_45E2_B306_7BEFBF3F3205__INCLUDED_)
#define AFX_AUDIODX_H__75427EBD_9F1A_45E2_B306_7BEFBF3F3205__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define NUM_REC_NOTIFICATIONS	4
#define NUM_PLAY_NOTIFICATIONS  4
//#ifndef DWORD_PTR
//#define DWORD_PTR LPDWORD
//#endif
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include "directx/dxerr8.h"
#include "xastruct.h"

//class DXCAPTUREINFO //: public XAUDIOINFO
//{
//public:
//	LPDIRECTSOUNDCAPTURE		pDSCapture;
//	LPDIRECTSOUNDCAPTUREBUFFER	pDSBCapture;
//	LPDIRECTSOUNDNOTIFY			pDSNotify;
//	DSBPOSITIONNOTIFY			aPosNotify[ NUM_REC_NOTIFICATIONS + 1 ];  
//	DWORD						dwCaptureBufferSize;
//	DWORD						dwNextCaptureOffset;
//	DWORD						dwNotifySize;
//};

class DXPLAYERINFO : public XAUDIOINFO
{
public:
	LPDIRECTSOUNDBUFFER			pDSBOutput;
	LPDIRECTSOUNDNOTIFY8 		pDSNotify;
	DSBPOSITIONNOTIFY			aPosNotify[ NUM_PLAY_NOTIFICATIONS + 1 ];
	DWORD						dwOutputBufferSize;
	DWORD						dwNotifySize;
	DWORD						dwNextOutputOffset;
	DWORD						dwPlayLossSize;
};
class XAUDIOPACKET;
class CAudioDX  
{
public:
	CAudioDX();
	virtual ~CAudioDX();

public:

	BOOL			bDXAudioInitialized;
	LPDIRECTSOUND8	pDS8;
	//static LPDIRECTSOUNDBUFFER	pDSBPrimary = NULL;
	HWND			hWindow;
	int				PacketSize;
	WAVEFORMATEX	m_waveformat;	
public:
	void SetPacketSize(int nsize);
	
	HRESULT InitializeAudio( HWND hWnd );

	void FinalizeAudio( );

	XAUDIOINFO *GetPlayerInfo( );

	void ReleasePlayerInfo( XAUDIOINFO *pai );

	HRESULT InitializePlayer( XAUDIOINFO *pai );

	HRESULT StartPlayer( XAUDIOINFO *pai );

	HRESULT StopPlayer( XAUDIOINFO *pai );

	HRESULT PlayerGetVolume( XAUDIOINFO *pai, DWORD *vol );

	HRESULT PlayerSetVolume( XAUDIOINFO *pai, DWORD vol );

	HRESULT PlayerWritePacket( XAUDIOINFO *pai, XAUDIOPACKET *pkt );

	void FinalizePlayer( XAUDIOINFO *pai );

};

#endif // !defined(AFX_AUDIODX_H__75427EBD_9F1A_45E2_B306_7BEFBF3F3205__INCLUDED_)
